<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<table border="1">
    <tr>
        <th>选择</th>
        <th>编号</th>
        <th>书名</th>
        <th>价格</th>
        <th>类目</th>
        <th>库存</th>
        <th>图片</th>
        <th>说明</th>
        <th>作者</th>
        <td>已售</td>
    </tr>
    <form action="/book/del" method="post" onsubmit="return validataForm()">
        <tr th:each="book:${page.list}">
            <th><input type="checkbox" name="ids" th:value="${book.id}"></th>
            <th th:text="${book.id}"></th>
            <th th:text="${book.name}"></th>
            <th th:text="${book.price}"></th>
            <th th:text="${book.category}"></th>
            <th th:text="${book.pnum}"></th>
            <th th:text="${book.imgurl}"></th>
            <th th:text="${book.description}"></th>
            <th th:text="${book.author}"></th>
            <th th:text="${book.sales}"></th>
        </tr>
        <input type="submit" value="删除" onsubmit="return validataForm()">
    </form>
</table>
总的页数：<span th:text="${page.pages}"></span>
总的记录数：<span th:text="${page.total}"></span>
当前页的记录数：<span th:text="${page.size}"></span>
当前页：<span th:text="${page.pageNum}"></span>
<span th:if="${page.hasPreviousPage}">
    <a th:href="@{/book/page(pageNum=${page.pageNum-1})}">上一页</a>
</span>
<span th:each="p:${#numbers.sequence(1,page.pages)}">
    <a th:href="@{/book/page(pageNum=${p})}" th:text="${p}"></a>
</span>
<span th:if="${page.hasNextPage}">
    <a th:href="@{/book/page(pageNum=${page.pageNum+1})}">下一页</a>
</span>
</body>
<script src="/js/jquery.js"></script>
<script>
    function validataForm() {
        if ($("input[name='ids']:checked").length==0){
            alert("必须选一个删除")
            return false
        }

        if (confirm("确定要删除？")){
        }else {
            alert("已取消删除")
            return false
        }
    }
</script>
</html>